cmake_minimum_required(VERSION 3.21)
project(cpplearn)

set(CMAKE_CXX_STANDARD 14)

#include_directories(./ ./lib/ ~/work/clib/)
include_directories(./ ./lib/)

# 遍历项目根目录下所有的 .cpp 文件
#file(GLOB files *.cpp)

# 这样在运行框会多一个 CMakeCXXCompilerId，不过无伤大雅
file(GLOB_RECURSE files *.cpp)

foreach (file ${files})
    string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file})
    add_executable(${exe} ${file})
    message(\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe})
endforeach ()